import React, { useEffect, useState } from 'react'
import Bottom from './Bottom'
import './App.css'
import * as api from './server'

const Me = () => {
  const [user, setUser] = useState({})

  useEffect(() => {
    api.getUser('HL1115')
      .then(res => {
        // console.log(res.data);
        setUser(res.data);
      })
  }, []);

  // console.log(user);

  api.userToken({
    accesstoken: 'e73b268b-f5d2-4ff1-8fd9-3581b84962e2'
  })
    .then(res => {
      if (res.success) {
        console.log(res)
      }
    })

  return (
    <div>
      <div>
        <div><img style={{ height: '80px', width: '80px' }} src={user.avatar_url} /></div>
        <span>用户名:{user.loginname}</span>
      </div>
      <div className="bottom"><Bottom /></div>
    </div>
  )
}

export default Me